package com.settlement.system.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.settlement.system.common.base.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
        import java.math.BigDecimal;
        import java.time.LocalDateTime;

/**
* <p>
* 抖音资金流水
* </p>
*
* @author huangrensen
* @since 2024-05-30
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DyFundFlow extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
    * ID
    */
    @TableId(value = "id")
    private String id;


    /**
    * 店铺ID
    */
    private Long storeId;
    @TableField(exist = false)
    private String storeName;


    /**
    * 动账时间
    */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime billTime;


    /**
    * 动帐流水号
    */
    private String flowNo;


    /**
    * 动账方向
    */
    private String direction;


    /**
    * 动账金额
    */
    private BigDecimal flowAmount = BigDecimal.ZERO;


    /**
    * 动账账户
    */
    private String account;


    /**
    * 动账场景
    */
    private String scene;


    /**
    * 计费类型
    */
    private String feeType;


    /**
    * 子订单号
    */
    private String subOrderNo;


    /**
    * 订单号
    */
    private String orderNo;


    /**
    * 售后编号
    */
    private String saleNo;


    /**
    * 下单时间
    */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime orderTime;


    /**
    * 商品ID
    */
    private String goodsId;


    /**
    * 订单类型
    */
    private String orderType;


    /**
    * 订单实付应结
    */
    private BigDecimal actPayAmount = BigDecimal.ZERO;


    /**
    * 运费实付
    */
    private BigDecimal actFeeAmount = BigDecimal.ZERO;


    /**
    * 实际平台补贴_运费
    */
    private BigDecimal feeSubsidy = BigDecimal.ZERO;


    /**
    * 实际平台补贴
    */
    private BigDecimal platformSubsidy = BigDecimal.ZERO;


    /**
    * 实际达人补贴
    */
    private BigDecimal drSubsidy = BigDecimal.ZERO;


    /**
    * 实际抖音月付营销补贴
    */
    private BigDecimal dySubsidy = BigDecimal.ZERO;


    /**
    * 订单退款
    */
    private BigDecimal refundAmount = BigDecimal.ZERO;


    /**
    * 平台服务费
    */
    private BigDecimal serviceAmount = BigDecimal.ZERO;


    /**
    * 佣金
    */
    private BigDecimal commission = BigDecimal.ZERO;


    /**
    * 渠道分成
    */
    private BigDecimal channelFee = BigDecimal.ZERO;


    /**
    * 招商服务费
    */
    private BigDecimal investmentServiceFee = BigDecimal.ZERO;


    /**
    * 站外推广费
    */
    private BigDecimal promotionFee = BigDecimal.ZERO;


    /**
    * 其他分成
    */
    private BigDecimal otherFee = BigDecimal.ZERO;


    /**
    * 是否免佣
    */
    private String noCommission;


    /**
    * 免佣金额
    */
    private BigDecimal noCommissionAmount = BigDecimal.ZERO;


    /**
    * 以旧换新抵扣
    */
    private BigDecimal oldNewSubsidy = BigDecimal.ZERO;


    /**
    * 银行补贴
    */
    private BigDecimal bankSubsidy = BigDecimal.ZERO;


    /**
    * 服务商佣金
    */
    private BigDecimal serviceCommission = BigDecimal.ZERO;

    /**
    * 实际抖音支付补贴
    */
    private BigDecimal dyPaySubsidy = BigDecimal.ZERO;


    /**
    * 备注
    */
    private String remark;
    @TableField(exist = false)
    private String billMonth;
    @TableField(exist = false)
    private String tableName;

    // 截取长度超出范围的字段
    public void cutString() {
        if (this.remark != null && this.remark.length() > 2000) {
            this.remark = this.remark.substring(0, 2000);
        }
    }
}
